package offer.algorithm;

import org.apache.commons.lang3.StringUtils;

/**
 * Description：
 * Author: zhangc
 * Date：2017/7/28 15:22
 */
public class StringNumeric54 {

    //TODO 待完成
    public static boolean isNumeric(String string) {
        if (string == null || string.length() <= 0 || string.matches("^[-\\+]?[\\d]*e*E*$"))
            return false;
        if (string.toLowerCase().contains("e"))
            return sciNumeric(string);
        else if (string.contains("."))
            return floatNumeric(string);
        return commomNumeric(string);
    }

    private static boolean sciNumeric(String string) {
        return false;
    }

    private static boolean floatNumeric(String string) {
        return string.matches("^-?[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*$");
    }

    private static boolean commomNumeric(String string) {
        return false;
    }

    public static void main(String[] args) {
        System.out.println(floatNumeric("+2.23233"));
    }

}
